package com.gupao.gupaoeduvippattern.javaBase.thread.day01_2;

/**
 * @author Administrator
 * @date 2020-12-05 16:40
 */
public class Letter implements Runnable {

    private char[] letter = new char[26];

    public Letter(){
        for(int i=97; i<=122; i++){
            letter[i-97] = (char)i;
        }
    }

    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see Thread#run()
     */
    @Override
    public void run() {
        for(char c : letter){
            System.out.print(c);
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
